import React from 'react'
import conf from '@/config'
import '@/components/downloadFooter.less'

class Head extends React.Component {

  matchString (str, arr) {
    if (str === '' || arr.length === 0) {
      return false
    }
    for (let v = 0; v < arr.length; v++) {
      if (str.toLowerCase().indexOf(arr[v]) > 0) {
        return true
      }
    }
    return false
  }
  render() {
    let header = this.props.header
    let ua = header['user-agent']
    let arr = ['ipad', 'iphone', 'ipod']
    let res = this.matchString(ua, arr)
    const link = res ? conf.appStore : conf.googlePlay
    return (
      <div className="download-footer">
        <img src="/static/common/56x56.png" className="logo" />
        <p>Free Manga</p>
        <a href={link} >Download</a>
      </div>
    )
  }
}
export default Head
